package day06;

public class MethodDemo02 {
    public static void main(String[] args) {
                          //数组元素长度//最大值
        int[] num = testArray(20,100);
        System.out.println("数组的长度:"+num.length);
        int[] num1 = testArray(10,1000);
        for(int i = 0;i<num1.length;i++){
            System.out.println("num1["+i+"]="+num1[i]);//输出数组每一个元素的值
        }
    }                             //加一个参数
    public static int[] testArray(int len,int max){
        int[] arr = new int[len];
        for(int i = 0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*(max+1));
        }
        return arr;
    }
}
